home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / strlib.zip / BZERO.C < prev    next >
Text File  |  1993-01-04  |  768b  |  37 lines

  1.  
  2. /*  File   : bzero.c
  3.     Author : Richard A. O'Keefe.
  4.     Updated: 23 April 1984
  5.     Defines: bzero()
  6.  
  7.     bzero(dst, len) moves "len" 0 bytes to "dst".
  8.     Thus to clear a disc buffer to 0s do bzero(buffer, BUFSIZ).
  9.  
  10.     Note: the "b" routines are there to exploit certain VAX order codes,
  11.     but the MOVC5 instruction will only move 65535 characters.   The asm
  12.     code is presented for your interest and amusement.
  13. */
  14.  
  15. #include "strings.h"
  16.  
  17. #if     VaxAsm
  18.  
  19. void bzero(dst, len)
  20.     char *dst;
  21.     int len;
  22.     {
  23.         asm("movc5 $0,*4(ap),$0,8(ap),*4(ap)");
  24.     }
  25.  
  26. #else  ~VaxAsm
  27.  
  28. void bzero(dst, len)
  29.     register char *dst;
  30.     register int len;
  31.     {
  32.         while (--len >= 0) *dst++ = 0;
  33.     }
  34.  
  35. #endif  VaxAsm
  36.  
  37.